package com.yuw.examdemo1;

public class Person {
    // 成员变量
    private static String perName;
    private String perSex;
    private int perAge;

    // 静态代码块 -- 初始化用，执行且只执行一次
    static {
        perName = "张三";
        System.out.println("执行了父类Person类的静态代码块方法");
    }

    // 非静态代码块
    {
        System.out.println("执行了父类Person类的非静态代码块方法");
    }

    // 成员方法

    public Person(String perName, String perSex, int perAge) {
        this.perName = perName;
        this.perSex = perSex;
        this.perAge = perAge;
    }

    public Person() {
        System.out.println("调用了父类Person的默认构造方法");
    }

    /**
     * 吃饭的行为
     */
    public void doEating() {
        System.out.println(perName + " is eating...");
    }

}
